package com.usian.article.client;

import com.usian.model.article.dtos.ArticleDto;
import com.usian.model.article.dtos.AuthorDto;
import com.usian.model.media.dtos.WmNewsResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Fay
 * @date 2022/7/6&11:38
 */
@FeignClient("leadnews-article")
public interface ArticleClient {
    @GetMapping("/api/v1/article/findByUserId/{id}")
    public AuthorDto findByUserId(@PathVariable("id") Integer apUserId);
    /**
     * 保存作者
     * @param authorDto
     * @return
     */
    @PostMapping("/api/v1/author/save")
    public Integer saveAuthor(@RequestBody AuthorDto authorDto);

    /**
     * 保存文章
     * @param
     * @return id
     */
    @PostMapping("/api/v1/article/save")
    public Long saveArticle(@RequestBody WmNewsResultDTO wmNewsDTO);

    @PostMapping("/api/v1/author/one/{id}")
    public AuthorDto findById(@PathVariable("id") Integer id);

    /**
     * 分页查询文章信息
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/api/v1/article/findByPage")
    List<ArticleDto> findArticleByPage(@RequestParam(name = "page") int page,
                                       @RequestParam(name = "size") int size);
}
